#include "Node.h"
#include "AST.h"

Node::Node(DesignEntity *designEntity, int stmtNumber){
	this->stmtNumber = stmtNumber;
	this->designEntity = designEntity;
	this->children = vector<Node*>();
	AST::addToDETable(this);
}

int Node::setNodeID(int nodeID){
	this->nodeID = nodeID;
	return nodeID;
}

int Node::getNodeID(){
	return nodeID;
}

int Node::getStmtNumber(){
	return stmtNumber;
}

DesignEntity* Node::getDesignEntity(){
	return designEntity;
}

bool Node::addChildNode(Node* childNode){
	if (childNode == NULL) return false;
	childNode->setParent(this);
	children.push_back(childNode);
	return true;
}

bool Node::setParent(Node* parent) {
	if (parent == NULL) return false;
	this->parent = parent;
	return true;
}

Node* Node::getParent(){
	return parent;
}

vector<Node*> Node::getChildren(){
	return children;
}

bool Node::equals(Node* otherNode){
	if (this->getDesignEntity()->equal(otherNode->getDesignEntity()))  {
		return true;
	} else {
		return false;
	}
}